package com.hailin.pigserver.controller;

import com.hailin.pigapi.model.Pig;
import com.hailin.pigserver.service.PigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/pigServer")
public class PigController {

    @Autowired
    private PigService pigService;

    @GetMapping("/all")
    public List<Pig> queryAll(){
        return pigService.queryAll();
    }
}
